package ar.uade.fain.ai.tpo.view.producto;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import ar.uade.fain.ai.tpo.Sistema;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class BajaProducto extends javax.swing.JFrame {

	private static final long serialVersionUID = 1L;

	private JButton bajaProductoButton;
	private JLabel idLabel;
	private JTextField idText;

	/**
	 * Auto-generated main method to display this JFrame
	 */
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				BajaProducto inst = new BajaProducto();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}

	public BajaProducto() {
		super();
		initGUI();
	}

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				bajaProductoButton = new JButton();
				getContentPane().add(bajaProductoButton);
				bajaProductoButton.setText("Baja Producto");
				bajaProductoButton.setBounds(139, 195, 88, 23);

				bajaProductoButton.addActionListener(new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent arg0) {
						String i_d = idText.getText();
						Long id = i_d == null || i_d.isEmpty() ? null : Long.parseLong(i_d);
						Sistema.get().getProductoControlador().bajaProducto(id);

					}
				});
			}
			{
				idLabel = new JLabel();
				getContentPane().add(idLabel);
				idLabel.setText("id Producto:");
				idLabel.setBounds(25, 70, 139, 16);
			}
			{
				idText = new JTextField();
				getContentPane().add(idText);
				idText.setBounds(194, 67, 162, 23);
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			// add your error handling code here
			e.printStackTrace();
		}
	}

}
